// The Vue build version to load with the `import` command
// (runtime-only or standalone) has been set in webpack.base.conf with an alias.
import Vue from 'vue'
import App from './App'
import router from './router'
import axios from 'axios'
import { http } from './tool/tool'
import {apiObj} from './api/api.js'

// 引入ElementUI
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import './style/base.scss'
// 全局引用
Vue.use(ElementUI)
import store from './store'
Vue.config.productionTip = false
Vue.prototype.$http = http(axios);
Vue.prototype.apiObj = apiObj

/* eslint-disable no-new */
new Vue({
  el: '#app',
  router,
  store,
  components: { App },
  template: '<App/>'
})
axios.interceptors.response.use((response) => {
  if(response.data.status == '200'){
    // console.log('状态200')
    store.commit('changeLoading')
    // console.log(store.state.main.loadingStatus)
  }else{
    // console.log('状态非200')
  }
  return response.data
}, (error) => {
  return Promise.reject(error)
})


